package com.lanou3g.demo.service.impl;

import com.lanou3g.demo.entity.Cost;
import com.lanou3g.demo.mapper.CostMapper;
import com.lanou3g.demo.service.ICostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class CostService implements ICostService {


   @Autowired
    private CostMapper costMapper;

    /**
     * 查询cost表里的所有信息
     * @return
     */
    @Override
    public List<Cost> findAll() {
        return costMapper.findAll();
    }

    /**
     * 添加cost的信息
     * @param cost
     * @return
     */
    @Override
    public int addCost(Cost cost) {

        return costMapper.addCost(cost);
    }

    /**
     * 删除cost的信息
     * @param costId
     * @return
     */
    @Transactional
    @Override
    public int delOne(Integer costId) {
        return costMapper.delOne(costId);
    }

    /**
     * 修改cost 的信息
     * @param cost
     * @return
     */
    @Override
    public int updateCost(Cost cost) {
        return costMapper.updateCost(cost);
    }

    /**
     * 根据costId来修改cost的状态
     * @param costId
     * @return
     */
    @Override
    public int upStatus(Integer costId) {
        return costMapper.upStatus(costId);
    }





    @Override
    public List<Cost> bdDesc() {
        return costMapper.bdDesc();
    }

    @Override
    public List<Cost> bdAsc() {
        return costMapper.bdAsc();
    }

    @Override
    public List<Cost> bcDesc() {
        return costMapper.bcDesc();
    }

    @Override
    public List<Cost> bcAsc() {
        return costMapper.bcAsc();
    }
}
